<?php 
class Router{
	public $page;
	public $view;
	public $id;
	
	public function  __construct(){
		$this->page = 'home';
		$this->view = 'default';
		$this->id = null;
	}
	
	public function dispatch(){
	if(isset($_SERVER['PATH_INFO'])){
		$page_url = explode("/",$_SERVER['PATH_INFO']);
		if(count($page_url) > 1){
			$req_page = str_replace(".html","",$page_url[count($page_url)-1]);
			switch($req_page)
				{
					case 'ten-mien':		$this->page = 'domain';		break;
					case 'hosting':			$this->page = 'hosting';	break;
					case 'may-chu-ao':		$this->page = 'vps';		break;
					case 'may-chu':			$this->page = 'server';		break;
					case 'dich-vu-website':	$this->page = 'home';		break;
					case 'ho-tro':			$this->page = 'blog';		break;
					case 'lien-he':			$this->page = 'contact';	break;
					case 'chi-tiet':		$this->page = 'detail';		break;
				}
			}
		}
		else {
			$this->page = 'home';
		}
	}
}